const fs = require('fs');
const promisify = function(callBack) {
  return function(...args) {
    return new Promise((resolve, reject) => {
      callBack(...args, (err, data) => {
        if (err) reject(err);
        else resolve(data);
      })
    })
  }
}

const fsReadFile = promisify(fs.readFile);
fsReadFile('./test.txt', 'utf-8').then(data => {
  console.log(data);
}).catch(err => {
  console.log(err);
})